#include <iostream>
#include <vector>
#include <string>
#include <stack>

using namespace std;

int main()
{
	stack<char> s;
	char c;
	while (cin >> c) {
		if (s.size() && abs(s.top() - c) == 32) s.pop();
		else s.push(c);
	}
	string ans; while (s.size()) ans.push_back(s.top()), s.pop();
	reverse(ans.begin(), ans.end());
	cout << ans;

	return 0;
}